from pydantic import BaseModel, Field
from typing import Optional
from fastapi import Query


class DictTypeQuery(BaseModel):
    page: int = Field(1, ge=1, description="页码", alias="current")
    size: int = Field(10, ge=1, le=100, description="每页数量")
    type_code: Optional[str] = Field(None, description="字典类型编码筛选")
    type_name: Optional[str] = Field(None, description="字典类型名称筛选")
    keyword: Optional[str] = Field(None, description="关键词搜索（编码/名称/描述）")


def dict_type_list_query(
    page: int = Query(1, ge=1, description="页码"),
    size: int = Query(10, ge=1, le=100, description="每页数量"),
    type_code: Optional[str] = Query(None, description="类型编码筛选"),
    type_name: Optional[str] = Query(None, description="类型名称筛选"),
    keyword: Optional[str] = Query(None, description="关键词搜索"),
) -> DictTypeQuery:
    return DictTypeQuery(
        page=page,
        size=size,
        type_code=type_code,
        type_name=type_name,
        keyword=keyword,
    )